<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>Rails::Initializable</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/github.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>     
    <div class="banner">
        
            <span>Ruby on Rails v4.0.0</span><br />
        
        <h1>
            <span class="type">Module</span> 
            Rails::Initializable 
            
        </h1>
        <ul class="files">
            
            <li><a href="../../files/railties/lib/rails/initializable_rb.html">railties/lib/rails/initializable.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
  


  


  
  


  
    <!-- Namespace -->
    <div class="sectiontitle">Namespace</div>
    <ul>
      
        <li>
          <span class="type">MODULE</span>
          <a href="Initializable/ClassMethods.html">Rails::Initializable::ClassMethods</a>
        </li>
      
        <li>
          <span class="type">CLASS</span>
          <a href="Initializable/Collection.html">Rails::Initializable::Collection</a>
        </li>
      
        <li>
          <span class="type">CLASS</span>
          <a href="Initializable/Initializer.html">Rails::Initializable::Initializer</a>
        </li>
      
    </ul>
  


  
    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
      
        <dt>I</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Initializable.html#method-i-initializers">initializers</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>R</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="Initializable.html#method-i-run_initializers">run_initializers</a>
              </li>
            
          </ul>
        </dd>
      
    </dl>
  

  



  

    

    

    


    


    <!-- Methods -->
        
      <div class="sectiontitle">Instance Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-i-initializers">
            
              <b>initializers</b>()
            
            <a href="Initializable.html#method-i-initializers" name="method-i-initializers" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-initializers_source')" id="l_method-i-initializers_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/bc7ac33846274a0d2c93741bf6df441d4853e4e9/railties/lib/rails/initializable.rb#L60" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-initializers_source" class="dyn-source">
                <pre><span class="ruby-comment"># File railties/lib/rails/initializable.rb, line 60</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">initializers</span>
  <span class="ruby-ivar">@initializers</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">initializers_for</span>(<span class="ruby-keyword">self</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-run_initializers">
            
              <b>run_initializers</b>(group=:default, *args)
            
            <a href="Initializable.html#method-i-run_initializers" name="method-i-run_initializers" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-run_initializers_source')" id="l_method-i-run_initializers_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/bc7ac33846274a0d2c93741bf6df441d4853e4e9/railties/lib/rails/initializable.rb#L52" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-run_initializers_source" class="dyn-source">
                <pre><span class="ruby-comment"># File railties/lib/rails/initializable.rb, line 52</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">run_initializers</span>(<span class="ruby-identifier">group</span>=<span class="ruby-value">:default</span>, *<span class="ruby-identifier">args</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">instance_variable_defined?</span>(<span class="ruby-value">:@ran</span>)
  <span class="ruby-identifier">initializers</span>.<span class="ruby-identifier">tsort_each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">initializer</span><span class="ruby-operator">|</span>
    <span class="ruby-identifier">initializer</span>.<span class="ruby-identifier">run</span>(*<span class="ruby-identifier">args</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">initializer</span>.<span class="ruby-identifier">belongs_to?</span>(<span class="ruby-identifier">group</span>)
  <span class="ruby-keyword">end</span>
  <span class="ruby-ivar">@ran</span> = <span class="ruby-keyword">true</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                    </div>

    </div>
  </body>
</html>    